<html>
<head><meta charset="utf-8"><title>polymorphization estimates · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html">polymorphization estimates</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="151785119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/151785119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#151785119">(Dec 14 2018 at 16:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> chat in about 30 minutes?</p>



<a name="151786192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/151786192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#151786192">(Dec 14 2018 at 16:24)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> sure</p>



<a name="151786332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/151786332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#151786332">(Dec 14 2018 at 16:26)</a>:</h4>
<p>ok gimme a few minutes</p>



<a name="151792130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/151792130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#151792130">(Dec 14 2018 at 18:00)</a>:</h4>
<p>ok <span class="user-mention" data-user-id="116107">@davidtwco</span> the branch we were working on is here:</p>
<p><a href="https://github.com/nikomatsakis/rust/tree/polymorphize-analysis" target="_blank" title="https://github.com/nikomatsakis/rust/tree/polymorphize-analysis">https://github.com/nikomatsakis/rust/tree/polymorphize-analysis</a></p>
<p>it includes the (now passing) test. I'd say the next steps are to </p>
<ul>
<li>add some dependencies due to size/alignment </li>
<li>do the inter-procedural propagation</li>
</ul>
<p>well that and maybe write some comments. =)</p>



<a name="151792812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/151792812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#151792812">(Dec 14 2018 at 18:10)</a>:</h4>
<p>Sounds good, will try to take a look at it tonight.</p>



<a name="151793753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/151793753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#151793753">(Dec 14 2018 at 18:24)</a>:</h4>
<p>those two steps seem pretty independent</p>



<a name="151833730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/151833730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#151833730">(Dec 15 2018 at 11:20)</a>:</h4>
<p>Added a commit on <a href="https://github.com/davidtwco/rust/tree/polymorphize-analysis" target="_blank" title="https://github.com/davidtwco/rust/tree/polymorphize-analysis">my copy of the branch</a> (no permissions on yours) for the <code>depend_size_alignment</code> test - I suspect however that it is slightly too specific to that test.</p>



<a name="151841811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/151841811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#151841811">(Dec 15 2018 at 16:02)</a>:</h4>
<p>Added a commit that tidies that up slightly and has a first - probably naive and inefficient - attempt at the inter-procedural propagation.</p>



<a name="152036110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152036110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152036110">(Dec 17 2018 at 15:32)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> <a href="https://github.com/nikomatsakis/rust/invitations" target="_blank" title="https://github.com/nikomatsakis/rust/invitations">invited you as a collaborator</a></p>



<a name="152036119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152036119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152036119">(Dec 17 2018 at 15:32)</a>:</h4>
<p>I can pull your commits tho</p>



<a name="152036127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152036127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152036127">(Dec 17 2018 at 15:32)</a>:</h4>
<p>Great, accepted that.</p>



<a name="152036147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152036147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152036147">(Dec 17 2018 at 15:33)</a>:</h4>
<p>Double check they're what we're looking for before pulling them :P</p>



<a name="152036246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152036246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152036246">(Dec 17 2018 at 15:34)</a>:</h4>
<p>I pulled them, but I'll check them out now :)</p>



<a name="152036248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152036248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152036248">(Dec 17 2018 at 15:34)</a>:</h4>
<p>or, soon</p>



<a name="152037552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037552">(Dec 17 2018 at 15:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> so I think what you want to be doing <a href="https://github.com/nikomatsakis/rust/blob/3e2bb22db9f5792202a90ac5afa045ed93c71c48/src/librustc_mir/transform/polymorphize.rs#L312-L330" target="_blank" title="https://github.com/nikomatsakis/rust/blob/3e2bb22db9f5792202a90ac5afa045ed93c71c48/src/librustc_mir/transform/polymorphize.rs#L312-L330">in this code</a> is using <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/layout/enum.SizeSkeleton.html#method.compute" target="_blank" title="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/layout/enum.SizeSkeleton.html#method.compute">the <code>SizeSkeleton::compute</code> function</a>. We can check the return type: if it is an <code>Ok</code> result with <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/layout/enum.SizeSkeleton.html#variant.Known" target="_blank" title="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/layout/enum.SizeSkeleton.html#variant.Known"><code>Known</code></a>, then there is no dependency.</p>
<p>It's a bit tricky to decide what to do otherwise. For now, we could use the existing <code>record_dependency</code> logic on the "unknown parts", but it's not really as precise as we might like. Good enough for now.</p>



<a name="152037697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037697">(Dec 17 2018 at 15:53)</a>:</h4>
<p>Thanks, I'll get to that a little later today.</p>



<a name="152037706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037706">(Dec 17 2018 at 15:53)</a>:</h4>
<p>In particular, i'd like to identify the cases where "all we need to know is the size/alignment of the parameter", but that's actually a bit tricky. </p>
<p>For example, if we have a value of type <code>&amp;T::Item</code>, and <code>T::Item</code> is not known to be sized, we would get back a [<code>SizeSkeleton::Pointer](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/layout/enum.SizeSkeleton.html#variant.Pointer) variant that says we "just need to know </code>T::Item<code>". But knowing the size/alignment of </code>T` alone is not helpful.</p>



<a name="152037708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037708">(Dec 17 2018 at 15:53)</a>:</h4>
<p>But that's ok</p>



<a name="152037724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037724">(Dec 17 2018 at 15:53)</a>:</h4>
<p>Let's start with just capturing the higher-level stuff and then we'll try to separate out the cases</p>



<a name="152037779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037779">(Dec 17 2018 at 15:54)</a>:</h4>
<p>basically we'll be interested in some special cases where just knowing the size/align would be enough, and the rest would be some more general case</p>



<a name="152037809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037809">(Dec 17 2018 at 15:54)</a>:</h4>
<p>(really it also depends on how much work we'd be willing to put into doing layout code at runtime)</p>



<a name="152037813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037813">(Dec 17 2018 at 15:54)</a>:</h4>
<p>anyway let me look at the next commit now</p>



<a name="152037855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037855">(Dec 17 2018 at 15:55)</a>:</h4>
<p>I suspect the propagation isn't quite right but figured it was worth an attempt - first time trying to implement something like that from scratch.</p>



<a name="152037871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037871">(Dec 17 2018 at 15:55)</a>:</h4>
<p>yep, it's not</p>



<a name="152037878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037878">(Dec 17 2018 at 15:55)</a>:</h4>
<p>but it's in the right direction :)</p>



<a name="152037933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037933">(Dec 17 2018 at 15:56)</a>:</h4>
<p>btw</p>



<a name="152037942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037942">(Dec 17 2018 at 15:56)</a>:</h4>
<p>in both cases, I guess we're passing the tests we had?</p>



<a name="152037945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037945">(Dec 17 2018 at 15:56)</a>:</h4>
<p>(suggests we want some new tests)</p>



<a name="152037962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037962">(Dec 17 2018 at 15:56)</a>:</h4>
<p>Yeah, we pass all the tests that you wrote - including the ones that we had as <code>//FIXME</code>.</p>



<a name="152037980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037980">(Dec 17 2018 at 15:57)</a>:</h4>
<p>I'm a bit surprised by that</p>



<a name="152037994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152037994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152037994">(Dec 17 2018 at 15:57)</a>:</h4>
<p>maybe I missed something</p>



<a name="152038133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152038133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152038133">(Dec 17 2018 at 15:59)</a>:</h4>
<p>I'll do a local build and inspect</p>



<a name="152038622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152038622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152038622">(Dec 17 2018 at 16:06)</a>:</h4>
<p>pushed some tests for the local stuff at least, <span class="user-mention" data-user-id="116107">@davidtwco</span>, that are still failing :)</p>



<a name="152038842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152038842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152038842">(Dec 17 2018 at 16:08)</a>:</h4>
<p>Great, I'll take a look at them.</p>



<a name="152040439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152040439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152040439">(Dec 17 2018 at 16:29)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> do you have any thoughts on how I should change the propagation so it is more what you were looking for?</p>



<a name="152042632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152042632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152042632">(Dec 17 2018 at 17:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I want to look at why the existing tests are passing :) the main things I think are missing are:</p>
<ul>
<li>we should be doing substitution -- i.e., we should take the results from the callee and substitute the type parameters</li>
<li>we should be then processing those (substituted) types again, and we're not</li>
</ul>



<a name="152042648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152042648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152042648">(Dec 17 2018 at 17:00)</a>:</h4>
<p>What do you mean by processing in this case?</p>



<a name="152043842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152043842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152043842">(Dec 17 2018 at 17:18)</a>:</h4>
<p>mm I  mean we need to "examine" them to see whether the types in question are known</p>



<a name="152043855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152043855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152043855">(Dec 17 2018 at 17:18)</a>:</h4>
<p>e.g., if we had to know the size/alignment of <code>T</code>, and the caller knows that <code>T</code> is <code>u32</code>, we should be all set</p>



<a name="152044017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152044017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152044017">(Dec 17 2018 at 17:20)</a>:</h4>
<p>So, if we have a call edge to a function with a dependency - then there are two cases, it's either called with another type parameter that we don't know the size/alignment of, or it is called with a type that we know, such as <code>u32</code>? Do we still record a dependency in both cases, or only the former?</p>



<a name="152044562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152044562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152044562">(Dec 17 2018 at 17:26)</a>:</h4>
<p>only the former</p>



<a name="152044571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152044571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152044571">(Dec 17 2018 at 17:26)</a>:</h4>
<p>but the test I expected to exercise that path</p>



<a name="152044575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152044575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152044575">(Dec 17 2018 at 17:26)</a>:</h4>
<p>is passing</p>



<a name="152044577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152044577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152044577">(Dec 17 2018 at 17:26)</a>:</h4>
<p>and I don't know why</p>



<a name="152044741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152044741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152044741">(Dec 17 2018 at 17:28)</a>:</h4>
<p>I remember doing something to make that pass.</p>



<a name="152044745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152044745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152044745">(Dec 17 2018 at 17:28)</a>:</h4>
<p>But I forget what.</p>



<a name="152044798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152044798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152044798">(Dec 17 2018 at 17:29)</a>:</h4>
<p>ok :) I'l try to dig in later if I can scrape up a litle time</p>



<a name="152045069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152045069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152045069">(Dec 17 2018 at 17:32)</a>:</h4>
<p>One thing I’m not clear on is what end state we want to end up with - should we only end up with dependencies on functions that depend on some information about the type of a type parameter but not all the uses of those functions if a use provides a concrete type? I guess I mostly don’t understand how we’ll keep track that there was a use of the function with a concrete type since I feel like that would be necessary when deciding how many copies of the function to make? Or maybe I’m getting this backwards and thinking about the functions with dependencies as those where we want to polymorphize but jn fact it is the opposite - I think that’s it. I guess I’ve answered my own question.</p>



<a name="152045184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152045184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152045184">(Dec 17 2018 at 17:34)</a>:</h4>
<blockquote>
<p>should we only end up with dependencies on functions that depend on some information about the type of a type parameter but not all the uses of those functions if a use provides a concrete type?</p>
</blockquote>
<p>this sounds right</p>



<a name="152045201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152045201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152045201">(Dec 17 2018 at 17:34)</a>:</h4>
<blockquote>
<p>I guess I mostly don’t understand how we’ll keep track that there was a use of the function with a concrete type since I feel like that would be necessary when deciding how many copies of the function to make</p>
</blockquote>
<p>this code doesn't really have the job of deciding how many copies to make</p>



<a name="152045209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152045209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152045209">(Dec 17 2018 at 17:35)</a>:</h4>
<p>it has the job of deciding which aspects of the type parameters are important</p>



<a name="152045229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152045229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152045229">(Dec 17 2018 at 17:35)</a>:</h4>
<p>there is another piece of code that figures out the full set of copies that are needed (it's called the collector)</p>



<a name="152045245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152045245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152045245">(Dec 17 2018 at 17:35)</a>:</h4>
<p>Yeah, I think I get it now. I was conflating that.</p>



<a name="152045697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152045697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152045697">(Dec 17 2018 at 17:40)</a>:</h4>
<p>Doesn’t that mean that the collector already does some of what this code is doing? Perhaps naively, I’d assume that this collector would need to identify which functions have dependencies so it knows which will need multiple copies (assuming they’re instantiated with more than one type that has a different size/alignment or trait method impl and therefore will need multiple copies). Then it would do propagation to work out what distinct size/alignments it needs copies for?</p>



<a name="152046251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152046251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152046251">(Dec 17 2018 at 17:48)</a>:</h4>
<p>(Assuming that the collector is some code that already exists and isn’t something we’re going to add later)</p>



<a name="152096523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152096523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152096523">(Dec 18 2018 at 09:42)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Pushed a commit with the <code>SizeSkeleton::compute</code> check.</p>



<a name="152096550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152096550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152096550">(Dec 18 2018 at 09:42)</a>:</h4>
<p>Remembered that <a href="https://github.com/nikomatsakis/rust/blob/3e2bb22db9f5792202a90ac5afa045ed93c71c48/src/librustc_mir/transform/polymorphize.rs#L204-L206" target="_blank" title="https://github.com/nikomatsakis/rust/blob/3e2bb22db9f5792202a90ac5afa045ed93c71c48/src/librustc_mir/transform/polymorphize.rs#L204-L206">this was the fix</a> that made the <code>no_dependency_indirect</code> case pass - shouldn't be needed with the fixed propagation.</p>



<a name="152096637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152096637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152096637">(Dec 18 2018 at 09:45)</a>:</h4>
<p>I looked into trying to do the substitution and processing you mentioned but could quite work out how to do that. I expected that I'd need to take the <code>DefId</code> callee, substitute the <code>Substs</code> into that and then use the <code>ParamTy</code> as a sort of index to get the right type parameter that was the dependency back out as a <code>Ty</code> that I can then do the same size checks to decide whether to record a dependency.</p>



<a name="152096646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152096646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152096646">(Dec 18 2018 at 09:45)</a>:</h4>
<p>Not sure if that's right but it sounded right.</p>



<a name="152096993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152096993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152096993">(Dec 18 2018 at 09:53)</a>:</h4>
<p>(fairly certain it isn't)</p>



<a name="152097176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152097176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152097176">(Dec 18 2018 at 09:57)</a>:</h4>
<p>Also, can you confirm that the <code>dependency_because_embed_ref_sized</code> function should have a dependency? - there isn't a <code>FIXME</code> comment like in other tests and it didn't start to error like I'd have expected - wasn't sure if there was more I had to do or if it was incorrectly named.</p>



<a name="152099723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152099723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152099723">(Dec 18 2018 at 10:50)</a>:</h4>
<p>Ignore the above w/r/t propagation, figured it out and pushed a commit.</p>



<a name="152115301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152115301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152115301">(Dec 18 2018 at 15:25)</a>:</h4>
<blockquote>
<p>Remembered that <a href="https://github.com/nikomatsakis/rust/blob/3e2bb22db9f5792202a90ac5afa045ed93c71c48/src/librustc_mir/transform/polymorphize.rs#L204-L206" target="_blank" title="https://github.com/nikomatsakis/rust/blob/3e2bb22db9f5792202a90ac5afa045ed93c71c48/src/librustc_mir/transform/polymorphize.rs#L204-L206">this was the fix</a> that made the <code>no_dependency_indirect</code> case pass - shouldn't be needed with the fixed propagation.</p>
</blockquote>
<p>ah, I missed that line</p>



<a name="152115351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152115351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152115351">(Dec 18 2018 at 15:26)</a>:</h4>
<p>I'll pull and check out the latest in a bit :)</p>



<a name="152124359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152124359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152124359">(Dec 18 2018 at 17:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> looking now -- seems much closer! I think that the method <code>visit_ty</code> could use to be renamed, and doesn't look <em>quite</em> right. </p>
<p>For one thing, if the dependency is not related to size/alignment, then it doesn't matter whether we have a known size or not.</p>
<p>But also, maybe the idea of keying the dependency on just a <code>TyParam</code> is sort of flawed anyway, even for size. Maybe it'd be better to make the <code>Dependency</code> include either a <code>TraitRef</code> (indicating the method that is being invoked) or the full <code>Ty</code> that is being moved about, etc.</p>
<p>Then we can basically just implement <code>TypeFoldable</code> and apply the <code>subst</code> method to it, and then "re-add" it. In the case of a method dispatch, this would check whether the <code>Instance</code> is now statically known; in the case of a copy/move, it would check if the type is statically known.</p>



<a name="152124362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152124362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152124362">(Dec 18 2018 at 17:33)</a>:</h4>
<p>I have a test for at least one problem.</p>



<a name="152124372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152124372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152124372">(Dec 18 2018 at 17:33)</a>:</h4>
<p>I will push, and maybe try to make a few more tests to show what I'm talking about.</p>



<a name="152124379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152124379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152124379">(Dec 18 2018 at 17:34)</a>:</h4>
<p>(If you want, I can do the fix I'm talking about, or you can take a stab, I'm good either way)</p>



<a name="152124485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152124485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152124485">(Dec 18 2018 at 17:35)</a>:</h4>
<p>Feel free to, I'll take a go at whatever is left when I'm next looking at it.</p>



<a name="152124796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152124796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152124796">(Dec 18 2018 at 17:41)</a>:</h4>
<blockquote>
<p>But also, maybe the idea of keying the dependency on just a <code>TyParam</code> is sort of flawed anyway, even for size.</p>
</blockquote>
<p>What do you think is flawed about it?</p>



<a name="152125184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152125184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152125184">(Dec 18 2018 at 17:48)</a>:</h4>
<p>I pushed a few tests; it's at least <em>imprecise</em>. That said, poking a bit at my proposed alternative raised some questions and I stopped for now, since I want to look at your NLL PR first. =) </p>
<p>In particular, I realized that the set of call edges can grow dynamically as we get more precise, and I just wanted to think about what is the right question we should be asking precisely anyway.</p>



<a name="152125386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152125386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152125386">(Dec 18 2018 at 17:53)</a>:</h4>
<blockquote>
<p>Also, can you confirm that the <code>dependency_because_embed_ref_sized</code> function should have a dependency? - there isn't a <code>FIXME</code> comment like in other tests and it didn't start to error like I'd have expected - wasn't sure if there was more I had to do or if it was incorrectly named.</p>
</blockquote>
<p>Just going to bump this message because it's still something I'm unsure of.</p>



<a name="152143972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152143972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152143972">(Dec 18 2018 at 22:35)</a>:</h4>
<p>i'm confused about that question</p>



<a name="152143981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152143981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152143981">(Dec 18 2018 at 22:35)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I see this:</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">dependency_because_embed_ref_sized</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">t</span>: <span class="kp">&amp;</span><span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">EmbedRef</span><span class="o">&lt;</span><span class="na">&#39;_</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">//~^ ERROR no polymorphic dependencies found</span>
<span class="w">    </span><span class="c1">//</span>
<span class="w">    </span><span class="c1">// Here, the size of `EmbedRef` is known up front.</span>
<span class="w">    </span><span class="n">EmbedRef</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="152143983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152143983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152143983">(Dec 18 2018 at 22:35)</a>:</h4>
<p>i.e., <em>no</em> dependency</p>



<a name="152143986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152143986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152143986">(Dec 18 2018 at 22:35)</a>:</h4>
<p>I think this is correct because <code>T: Sized</code> is known</p>



<a name="152144073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152144073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152144073">(Dec 18 2018 at 22:37)</a>:</h4>
<p>oh, I see</p>



<a name="152144075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152144075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152144075">(Dec 18 2018 at 22:37)</a>:</h4>
<p>it is indeed ill-named</p>



<a name="152144192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152144192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152144192">(Dec 18 2018 at 22:39)</a>:</h4>
<p>Cool, I suspected it was but wanted to check.</p>



<a name="152144501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152144501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152144501">(Dec 18 2018 at 22:45)</a>:</h4>
<p>ps I'm working on the other thing I was talking about</p>



<a name="152145443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152145443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152145443">(Dec 18 2018 at 23:01)</a>:</h4>
<p>Great, I won’t be looking at the branch until tomorrow anyway.</p>



<a name="152201123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152201123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152201123">(Dec 19 2018 at 18:07)</a>:</h4>
<p>Do you have work-in-progress local changes for this? Not looking to do anything on it right now, just checking if you've got work locally as I might take a look later.</p>



<a name="152204686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152204686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152204686">(Dec 19 2018 at 19:02)</a>:</h4>
<p>good question :)</p>



<a name="152205327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152205327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152205327">(Dec 19 2018 at 19:12)</a>:</h4>
<p>I didn't get things working or bulding before I had to stop last night and I haven't had a chance to get back to it</p>



<a name="152205334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152205334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152205334">(Dec 19 2018 at 19:12)</a>:</h4>
<p>I may be able to put in a bit of time later on though</p>



<a name="152208959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152208959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152208959">(Dec 19 2018 at 20:05)</a>:</h4>
<p>ok <span class="user-mention" data-user-id="116107">@davidtwco</span> I have a pretty inefficient thing that seems to be working</p>



<a name="152208999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152208999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152208999">(Dec 19 2018 at 20:06)</a>:</h4>
<p>pushed</p>



<a name="152209050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152209050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152209050">(Dec 19 2018 at 20:06)</a>:</h4>
<p>For making <code>Dependency</code> contain a <code>TraitRef</code>/<code>Ty</code>?</p>



<a name="152209058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152209058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152209058">(Dec 19 2018 at 20:06)</a>:</h4>
<p>yes</p>



<a name="152209065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152209065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152209065">(Dec 19 2018 at 20:06)</a>:</h4>
<p>and in general just being more precise</p>



<a name="152209077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152209077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152209077">(Dec 19 2018 at 20:06)</a>:</h4>
<p>I didn't have time to write many comments :( but take a look if you get a sec</p>



<a name="152209081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152209081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152209081">(Dec 19 2018 at 20:06)</a>:</h4>
<p>and we can discuss how it works</p>



<a name="152209150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152209150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152209150">(Dec 19 2018 at 20:07)</a>:</h4>
<p>it fixes my newer tests anyway ;)</p>



<a name="152209381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152209381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152209381">(Dec 19 2018 at 20:11)</a>:</h4>
<p>I think I see how it works.</p>



<a name="152209517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152209517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152209517">(Dec 19 2018 at 20:13)</a>:</h4>
<p>You changed the error on <code>dependency_because_unsized_pointer_indirect</code> from "some dependencies" to "no dependencies" and removed the fixme - should that test be named <code>no_depend_because_unsized_pointer_indirect</code> or should there still be a <code>FIXME</code>?</p>



<a name="152210592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152210592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152210592">(Dec 19 2018 at 20:29)</a>:</h4>
<p>test name is wrong</p>



<a name="152210603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152210603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152210603">(Dec 19 2018 at 20:29)</a>:</h4>
<p>pushed fix</p>



<a name="152210703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152210703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152210703">(Dec 19 2018 at 20:30)</a>:</h4>
<p>Cool, so what are the next steps for this then?</p>



<a name="152210709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152210709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152210709">(Dec 19 2018 at 20:30)</a>:</h4>
<p>Try and make that more efficient or just get more test cases passing?</p>



<a name="152211047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152211047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152211047">(Dec 19 2018 at 20:35)</a>:</h4>
<p>efficiency only sort of matters at this stgae, since the primary goal is to get some statistics,</p>



<a name="152211055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152211055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152211055">(Dec 19 2018 at 20:36)</a>:</h4>
<p>but we do probably have to handle cross-crate correctly</p>



<a name="152211165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152211165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152211165">(Dec 19 2018 at 20:36)</a>:</h4>
<p>plus I there are surely other dependencies beyond copy/move</p>



<a name="152211186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152211186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152211186">(Dec 19 2018 at 20:37)</a>:</h4>
<p>e.g., accessing fields might require knowing layout of structs that might depend on type parameters</p>



<a name="152217410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152217410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152217410">(Dec 19 2018 at 22:17)</a>:</h4>
<p>I can try try to make some tests for that sort of thing</p>



<a name="152266350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152266350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152266350">(Dec 20 2018 at 16:08)</a>:</h4>
<p>I'm guessing <span class="user-mention" data-user-id="116107">@davidtwco</span> you didn't try to do anything here, right?</p>



<a name="152266840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152266840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152266840">(Dec 20 2018 at 16:14)</a>:</h4>
<p>Not yet, no.</p>



<a name="152562655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152562655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152562655">(Dec 26 2018 at 17:32)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I just pushed a new test, <a href="https://github.com/nikomatsakis/rust/blob/polymorphize-analysis/src/test/ui/polymorphize/polymorphize_place.rs" target="_blank" title="https://github.com/nikomatsakis/rust/blob/polymorphize-analysis/src/test/ui/polymorphize/polymorphize_place.rs"><code>polymorphize_place</code></a></p>



<a name="152562658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152562658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152562658">(Dec 26 2018 at 17:32)</a>:</h4>
<p>it includes a struct:</p>
<div class="codehilite"><pre><span></span><span class="k">struct</span> <span class="nc">OffsetDependent</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">t</span>: <span class="nc">T</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">count</span>: <span class="kt">u32</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="152562664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152562664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152562664">(Dec 26 2018 at 17:32)</a>:</h4>
<p>and a function like this</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">dependency_because_offset_depends_on_T</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">parameter</span>: <span class="kp">&amp;</span><span class="nc">OffsetDependent</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kt">u32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">//~^ ERROR no polymorphic dependencies found</span>
<span class="w">    </span><span class="c1">//</span>
<span class="w">    </span><span class="c1">// FIXME -- the offset of the `count` field depends on size/alignment of `T`</span>
<span class="w">    </span><span class="n">parameter</span><span class="p">.</span><span class="n">count</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>you can see the FIXME :)</p>



<a name="152562667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152562667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152562667">(Dec 26 2018 at 17:32)</a>:</h4>
<p>this is another sort of dependency we don't yet detect</p>



<a name="152562680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152562680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152562680">(Dec 26 2018 at 17:33)</a>:</h4>
<p>I guess we have to visit each <code>Field</code> projection in each place and check that the offset of that field is statically known</p>



<a name="152562746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152562746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152562746">(Dec 26 2018 at 17:34)</a>:</h4>
<p>probably by trying to construct a <code>Layout</code></p>



<a name="152562765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152562765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152562765">(Dec 26 2018 at 17:35)</a>:</h4>
<p>Alright, I’ll give this a shot.</p>



<a name="152565541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152565541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152565541">(Dec 26 2018 at 18:34)</a>:</h4>
<p>Do we want a new <code>DependencyKind</code> variant for this or should we just use <code>SizeAlignment</code>?</p>



<a name="152565806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152565806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152565806">(Dec 26 2018 at 18:41)</a>:</h4>
<p>Pushed what I have for that case.</p>



<a name="152566622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566622">(Dec 26 2018 at 18:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> well, it feels like a new variant; e.g., I could imagine having <code>OffsetOf(Ty, FieldIndex)</code> or something -- saying that the offset of the given field must be known</p>



<a name="152566679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566679">(Dec 26 2018 at 19:00)</a>:</h4>
<p>I thought it might, will update that now.</p>



<a name="152566687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566687">(Dec 26 2018 at 19:00)</a>:</h4>
<p>it feels different than size-alignment anyway</p>



<a name="152566689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566689">(Dec 26 2018 at 19:00)</a>:</h4>
<p>since knowing the size is not enough</p>



<a name="152566691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566691">(Dec 26 2018 at 19:00)</a>:</h4>
<p>maybe worth adding a test for that</p>



<a name="152566711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566711">(Dec 26 2018 at 19:01)</a>:</h4>
<p>if we were <em>really</em> smart we would realize that e.g. if you flip the order of the fields in that struct, the type <code>T</code> doesn't even matter</p>



<a name="152566719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566719">(Dec 26 2018 at 19:01)</a>:</h4>
<p>I'm trying to think of a case where we might know the size of a struct but still not know the answer we need</p>



<a name="152566721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566721">(Dec 26 2018 at 19:01)</a>:</h4>
<p>And the <code>FieldIndex</code> here is that of the field we need the offset of, not the field that causes the problem?</p>



<a name="152566725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566725">(Dec 26 2018 at 19:01)</a>:</h4>
<p>maybe that's just not possible</p>



<a name="152566728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566728">(Dec 26 2018 at 19:01)</a>:</h4>
<p>(or actually, the opposite)</p>



<a name="152566769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566769">(Dec 26 2018 at 19:02)</a>:</h4>
<blockquote>
<p>And the <code>FieldIndex</code> here is that of the field we need the offset of, not the field that causes the problem?</p>
</blockquote>
<p>correct</p>



<a name="152566773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566773">(Dec 26 2018 at 19:02)</a>:</h4>
<p>at least that was how I thought of it</p>



<a name="152566783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566783">(Dec 26 2018 at 19:02)</a>:</h4>
<p>That's easier for now, so I'll do that.</p>



<a name="152566798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566798">(Dec 26 2018 at 19:03)</a>:</h4>
<blockquote>
<p>I'm trying to think of a case where we might know the size of a struct but still not know the answer we need</p>
</blockquote>
<p>I guess that to know the size of a struct, we must know the offset of all of its fields</p>



<a name="152566803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566803">(Dec 26 2018 at 19:03)</a>:</h4>
<p>so I suppose that knowing the size <em>is</em> sufficient, just not <em>necessary</em></p>



<a name="152566847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566847">(Dec 26 2018 at 19:04)</a>:</h4>
<p>also, given that we re-order fields and things, the ordering of fields doesn't really matter</p>



<a name="152566856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566856">(Dec 26 2018 at 19:04)</a>:</h4>
<p>(unless the struct is <code>#[repr(C)]</code> but that is probably thinking too hard)</p>



<a name="152566857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566857">(Dec 26 2018 at 19:04)</a>:</h4>
<p>so maybe there isn't really a <em>need</em> for a new kind of dependency, though it also doesn't seem <em>bad</em> to have one</p>



<a name="152566870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566870">(Dec 26 2018 at 19:05)</a>:</h4>
<p>(so perhaps <span class="user-mention" data-user-id="116107">@davidtwco</span> your commit is basically good as is)</p>



<a name="152566937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566937">(Dec 26 2018 at 19:06)</a>:</h4>
<p>Even if was treated the exact same as the other variant, it's nice for some context I think.</p>



<a name="152566952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566952">(Dec 26 2018 at 19:07)</a>:</h4>
<p>yes</p>



<a name="152566957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566957">(Dec 26 2018 at 19:07)</a>:</h4>
<p>I'm trying to think what other cases could cause problems now</p>



<a name="152566962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152566962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152566962">(Dec 26 2018 at 19:07)</a>:</h4>
<p>I guess another example might be <em>assign</em> -- assigning to a local of unknown type</p>



<a name="152567011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567011">(Dec 26 2018 at 19:08)</a>:</h4>
<p>I'm just looking down the list of cases in the visitor basically</p>



<a name="152567020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567020">(Dec 26 2018 at 19:08)</a>:</h4>
<p>most cases wind up covered by <code>Operand</code></p>



<a name="152567046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567046">(Dec 26 2018 at 19:09)</a>:</h4>
<p>or some combination of other things</p>



<a name="152567090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567090">(Dec 26 2018 at 19:10)</a>:</h4>
<p>though it might be good to add code for them anyway (e.g., all local variables should have types of known size)</p>



<a name="152567253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567253">(Dec 26 2018 at 19:14)</a>:</h4>
<p>Pushed another commit with a new variant.</p>



<a name="152567406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567406">(Dec 26 2018 at 19:18)</a>:</h4>
<p>ok well I guess the next big steps is</p>
<ul>
<li>to make this work across crates</li>
<li>to integrate with the collector so we can give some sort of estimate of how much re-use we would get in practice</li>
</ul>



<a name="152567418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567418">(Dec 26 2018 at 19:19)</a>:</h4>
<p>I have to run now but I'll be back some tomorrow</p>



<a name="152567421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567421">(Dec 26 2018 at 19:19)</a>:</h4>
<p>I'm not 100% sure where the collector code lives these days :P</p>



<a name="152567426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567426">(Dec 26 2018 at 19:19)</a>:</h4>
<p>looks like this <code>rustc_mir::monomorphize::collector</code></p>



<a name="152567468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567468">(Dec 26 2018 at 19:20)</a>:</h4>
<p>so I think the idea would be to (presuming the option is enabled) take the full list of monomorphized items we need to create</p>



<a name="152567470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567470">(Dec 26 2018 at 19:20)</a>:</h4>
<p>take the dependency kinds we get for each fn</p>



<a name="152567473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567473">(Dec 26 2018 at 19:20)</a>:</h4>
<p>and kind of join the two together -- basically find out how many monomorphiations we could avoid</p>



<a name="152567483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567483">(Dec 26 2018 at 19:21)</a>:</h4>
<p>i.e., if we have some fn <code>foo&lt;T, U&gt;</code> and we find that it has a bunch of dependencies on <code>T</code> but none on <code>U</code>, and then we see that we make (currently) 4 copies <code>foo&lt;i32, i32&gt;</code>, <code>foo&lt;u32, i32&gt;</code>, <code>foo&lt;i32, u32&gt;</code>, and <code>foo&lt;u32, u32&gt;</code>,</p>



<a name="152567489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567489">(Dec 26 2018 at 19:21)</a>:</h4>
<p>then we would know that 2 of those copies could be avoided, and we could just make <code>foo&lt;i32, _&gt;</code> and <code>foo&lt;u32, _&gt;</code></p>



<a name="152567534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567534">(Dec 26 2018 at 19:22)</a>:</h4>
<p><span class="emoji emoji-1f44d" title="thumbs up">:thumbs_up:</span></p>



<a name="152567540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567540">(Dec 26 2018 at 19:22)</a>:</h4>
<p>I am debating the best way to do this :)</p>



<a name="152567547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567547">(Dec 26 2018 at 19:23)</a>:</h4>
<p>one way would be to take the dependencies for the fn, substitute the values of the type parameters, and then just have a hashset of those substituted results</p>



<a name="152567548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567548">(Dec 26 2018 at 19:23)</a>:</h4>
<p>I think that would be correct?</p>



<a name="152567554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567554">(Dec 26 2018 at 19:23)</a>:</h4>
<p>ah, I guess that we don't want to modify the <em>collector</em> really</p>



<a name="152567596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567596">(Dec 26 2018 at 19:24)</a>:</h4>
<p>instead, we can probably just invoke the query that returns its results</p>



<a name="152567598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567598">(Dec 26 2018 at 19:24)</a>:</h4>
<p>from inside the poloymorphization code</p>



<a name="152567601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567601">(Dec 26 2018 at 19:24)</a>:</h4>
<p>at least I think there is a query</p>



<a name="152567732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567732">(Dec 26 2018 at 19:28)</a>:</h4>
<p>ok, the query is <code>collect_and_partition_mono_items</code></p>



<a name="152567755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567755">(Dec 26 2018 at 19:29)</a>:</h4>
<p>I really do have to go now :) that's...probably not quite enough crumbs <span class="user-mention" data-user-id="116107">@davidtwco</span> to point you in the right direction, but I can try to leave some more details tips tomorrow :)</p>



<a name="152567757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152567757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152567757">(Dec 26 2018 at 19:29)</a>:</h4>
<p>and/or maybe I'll try to do a "first draft"</p>



<a name="152598366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152598366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152598366">(Dec 27 2018 at 12:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> pushed a new test, <a href="http://polymorphize_drop.rs" target="_blank" title="http://polymorphize_drop.rs">polymorphize_drop.rs</a>, showing a kind of dependency we are not accounting for</p>



<a name="152598382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152598382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152598382">(Dec 27 2018 at 12:00)</a>:</h4>
<p>specifically, we are not detecting when drop glue would have to be run</p>



<a name="152598595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152598595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152598595">(Dec 27 2018 at 12:06)</a>:</h4>
<p>I think that right now if we have a struct with three fields where the second field is the type parameter (that we don’t know the size of) then the current code will add a dependency for accessing the first field even though we’d know the offset?</p>



<a name="152598598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152598598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152598598">(Dec 27 2018 at 12:06)</a>:</h4>
<p>Is that expected?</p>



<a name="152598606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152598606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152598606">(Dec 27 2018 at 12:07)</a>:</h4>
<p>Since it tries to compute the layout of the whole struct but won’t be able to because of the later fields.</p>



<a name="152599130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599130">(Dec 27 2018 at 12:22)</a>:</h4>
<blockquote>
<p>I think that right now if we have a struct with three fields where the second field is the type parameter (that we don’t know the size of) then the current code will add a dependency for accessing the first field even though we’d know the offset?</p>
</blockquote>
<p>yes, that is correct, however I think that's ok</p>



<a name="152599134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599134">(Dec 27 2018 at 12:23)</a>:</h4>
<p>for one thing, the order of the fields is not actually important</p>



<a name="152599143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599143">(Dec 27 2018 at 12:23)</a>:</h4>
<p>we sort the fields so as to minimize total padding</p>



<a name="152599144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599144">(Dec 27 2018 at 12:23)</a>:</h4>
<p>when computing the layout</p>



<a name="152599146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599146">(Dec 27 2018 at 12:23)</a>:</h4>
<p>(unless the struct is <code>#[repr(C)]</code>)</p>



<a name="152599154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599154">(Dec 27 2018 at 12:23)</a>:</h4>
<p>so that implies we would have to know the size/alignment of all fields in order to figure out the offset of <em>any</em> field</p>



<a name="152599156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599156">(Dec 27 2018 at 12:23)</a>:</h4>
<p>Ah, I see, makes sense.</p>



<a name="152599197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599197">(Dec 27 2018 at 12:24)</a>:</h4>
<p>regardless, we have enough info to improve that later</p>



<a name="152599200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599200">(Dec 27 2018 at 12:24)</a>:</h4>
<p>if we did find cases we can handle :)</p>



<a name="152599204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152599204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152599204">(Dec 27 2018 at 12:24)</a>:</h4>
<p>but yeah I think there actually aren't many</p>



<a name="152603005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152603005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152603005">(Dec 27 2018 at 14:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> pushed an initial version of the analysis for how much size reduction we can achieve</p>



<a name="152603024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152603024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152603024">(Dec 27 2018 at 14:05)</a>:</h4>
<p>Will take a look.</p>



<a name="152603155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152603155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152603155">(Dec 27 2018 at 14:08)</a>:</h4>
<p>it's slightly conservative -- it is estimating how much reduction we could get with basically zero supporting infratructure from trans. (i.e., without threading any dynamic information or otherwise getting smarter)</p>



<a name="152655357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152655357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152655357">(Dec 28 2018 at 14:08)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I don't see any new commits, just checking: did you get a chance to look into the DROP stuff here?</p>



<a name="152655560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152655560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152655560">(Dec 28 2018 at 14:13)</a>:</h4>
<p>Not yet. Was travelling back from home yesterday and ended up not having a chance to.</p>



<a name="152655568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152655568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152655568">(Dec 28 2018 at 14:13)</a>:</h4>
<p>I’ll be able to take a look in a little bit though.</p>



<a name="152655682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152655682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152655682">(Dec 28 2018 at 14:16)</a>:</h4>
<p>OK.</p>



<a name="152655683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152655683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152655683">(Dec 28 2018 at 14:16)</a>:</h4>
<p>No <em>great</em> hurry</p>



<a name="152655684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152655684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152655684">(Dec 28 2018 at 14:16)</a>:</h4>
<p>I am looking a bit into the cross-crate question</p>



<a name="152655767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152655767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152655767">(Dec 28 2018 at 14:19)</a>:</h4>
<p>actually, maybe we can do this w/o disturbing the metadata encoder -- if we are calling a fn from across crates, either it must already be monomorphic, or we must have its MIR so we can monomorphize it</p>



<a name="152655770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152655770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152655770">(Dec 28 2018 at 14:19)</a>:</h4>
<p>so we could just re-analyze it</p>



<a name="152657903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152657903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152657903">(Dec 28 2018 at 15:16)</a>:</h4>
<p>Added a commit that makes the drop cases work as expected.</p>



<a name="152657904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152657904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152657904">(Dec 28 2018 at 15:16)</a>:</h4>
<p>I think it's perhaps a bit too naive but it worked?</p>



<a name="152659105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659105">(Dec 28 2018 at 15:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I think the better way to set that up would be to move the "if it contains a type parameter" logic into the <code>record_dependency</code> function</p>



<a name="152659117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659117">(Dec 28 2018 at 15:51)</a>:</h4>
<p>also, I think you can use the <code>needs_subst()</code> helper for that</p>



<a name="152659120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659120">(Dec 28 2018 at 15:51)</a>:</h4>
<p>but otherwise, probably ok</p>



<a name="152659126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659126">(Dec 28 2018 at 15:51)</a>:</h4>
<p>hmm</p>



<a name="152659131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659131">(Dec 28 2018 at 15:51)</a>:</h4>
<p>actually, there is a helper for this we can use to get more precise</p>



<a name="152659133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659133">(Dec 28 2018 at 15:51)</a>:</h4>
<p>e.g., we know that <code>&amp;T</code> never needs drop</p>



<a name="152659150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659150">(Dec 28 2018 at 15:52)</a>:</h4>
<p><code>ty.needs_drop(self.tcx, self.param_env)</code></p>



<a name="152659189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659189">(Dec 28 2018 at 15:52)</a>:</h4>
<p>let me add a test :)</p>



<a name="152659194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659194">(Dec 28 2018 at 15:52)</a>:</h4>
<p>I wasn't sure if <code>needs_drop</code> was redundant because we were already in a <code>TerminatorKind::Drop</code>.</p>



<a name="152659205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659205">(Dec 28 2018 at 15:52)</a>:</h4>
<p>hmm</p>



<a name="152659206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659206">(Dec 28 2018 at 15:53)</a>:</h4>
<p>you're not wrong, but you are wrong :P</p>



<a name="152659216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659216">(Dec 28 2018 at 15:53)</a>:</h4>
<p>that is, you're correct that MiR construction tries to avoid adding <code>TerminatorKind::Drop</code></p>



<a name="152659218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659218">(Dec 28 2018 at 15:53)</a>:</h4>
<p>but in indirect cases it is I think still relevant</p>



<a name="152659222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659222">(Dec 28 2018 at 15:53)</a>:</h4>
<p>one sec, I'll add a few more tests to show the problem</p>



<a name="152659305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659305">(Dec 28 2018 at 15:55)</a>:</h4>
<p>or hmm it's behaving correctly ;)</p>



<a name="152659313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659313">(Dec 28 2018 at 15:55)</a>:</h4>
<p>but still doesn't feel right</p>



<a name="152659367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659367">(Dec 28 2018 at 15:56)</a>:</h4>
<p>I've got it building locally with <code>.needs_drop()</code> helper instead of the <code>.walk().any(..)</code> approach.</p>



<a name="152659375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659375">(Dec 28 2018 at 15:56)</a>:</h4>
<p>yeah so that seems nicer but I still feel like that code is in the wrong place</p>



<a name="152659376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659376">(Dec 28 2018 at 15:56)</a>:</h4>
<p>and I'm surprised the tests are passing</p>



<a name="152659384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659384">(Dec 28 2018 at 15:57)</a>:</h4>
<p>I also moved it to the <code>record_dependency</code> function.</p>



<a name="152659387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659387">(Dec 28 2018 at 15:57)</a>:</h4>
<p>pushed a few new tests anyway</p>



<a name="152659390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659390">(Dec 28 2018 at 15:57)</a>:</h4>
<p>ok, but locally I don't see a failure</p>



<a name="152659391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659391">(Dec 28 2018 at 15:57)</a>:</h4>
<p>which I can't quite explain</p>



<a name="152659401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659401">(Dec 28 2018 at 15:57)</a>:</h4>
<p>It's easy enough to adjust the check, so if your new tests keep passing with that then I'll push it.</p>



<a name="152659443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659443">(Dec 28 2018 at 15:58)</a>:</h4>
<p>ok. I expect that in the cross-crate case, we will call <code>record_dependency</code>, and (the way it's setup locally) that means we'll unconditionally record the substituted dependency</p>



<a name="152659536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659536">(Dec 28 2018 at 16:00)</a>:</h4>
<p>(adding a bit of logging)</p>



<a name="152659592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/152659592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#152659592">(Dec 28 2018 at 16:01)</a>:</h4>
<p>Pushed the moved check/<code>needs_drop</code> change.</p>



<a name="154193984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154193984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154193984">(Jan 02 2019 at 19:07)</a>:</h4>
<p>ok <span class="user-mention" data-user-id="116107">@davidtwco</span> I think another useful thing would be to handle cross-crate edges better -- do you have time to investigate?</p>



<a name="154193993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154193993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154193993">(Jan 02 2019 at 19:07)</a>:</h4>
<p>I've got some time, yeah.</p>



<a name="154194313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194313">(Jan 02 2019 at 19:13)</a>:</h4>
<p>so I realized that this is probably easier than I initially thought</p>



<a name="154194416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194416">(Jan 02 2019 at 19:15)</a>:</h4>
<p>currently we have this:</p>
<div class="codehilite"><pre><span></span><span class="w">                </span><span class="k">if</span><span class="w"> </span><span class="n">call_edge</span><span class="p">.</span><span class="n">callee</span><span class="p">.</span><span class="n">is_local</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">substituted_dependencies</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">visitors</span><span class="p">[</span><span class="o">&amp;</span><span class="n">call_edge</span><span class="p">.</span><span class="n">callee</span><span class="p">]</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">dependencies</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="n">dependency</span><span class="o">|</span><span class="w"> </span><span class="n">dependency</span><span class="p">.</span><span class="n">subst</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">call_edge</span><span class="p">.</span><span class="n">substs</span><span class="p">))</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">collect</span><span class="p">();</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="c1">// FIXME: cross-crate dependencies. For now, assume that they depend</span>
<span class="w">                    </span><span class="c1">// on.. something.</span>
<span class="w">                    </span><span class="n">substituted_dependencies</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[</span><span class="n">Dependency</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">span</span>: <span class="nc">call_edge</span><span class="p">.</span><span class="n">span</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">kind</span>: <span class="nc">DependencyKind</span>::<span class="n">OtherMethod</span><span class="p">(</span><span class="n">call_edge</span><span class="p">.</span><span class="n">substs</span><span class="p">),</span><span class="w"></span>
<span class="w">                    </span><span class="p">}];</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="154194425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194425">(Jan 02 2019 at 19:15)</a>:</h4>
<p>but what I realized is that for any <strong>generic callee</strong>, the MIR is available to us</p>



<a name="154194431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194431">(Jan 02 2019 at 19:16)</a>:</h4>
<p>it will require some juggling though</p>



<a name="154194487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194487">(Jan 02 2019 at 19:16)</a>:</h4>
<p>right now we have this 2-phase setup where we first walk all the (local) def-ids and do the initial visitor</p>



<a name="154194489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194489">(Jan 02 2019 at 19:16)</a>:</h4>
<p>and then we walk the call edges and propagate effects around</p>



<a name="154194500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194500">(Jan 02 2019 at 19:16)</a>:</h4>
<p>I think what we would want to do is to make it possible to do the "initial visit" <em>lazilly</em></p>



<a name="154194513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194513">(Jan 02 2019 at 19:16)</a>:</h4>
<p>and/or make that first pass run through a queue of def-ids</p>



<a name="154194519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194519">(Jan 02 2019 at 19:16)</a>:</h4>
<p>that we extend as we encounter callees</p>



<a name="154194539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194539">(Jan 02 2019 at 19:17)</a>:</h4>
<p>alternatively</p>



<a name="154194543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194543">(Jan 02 2019 at 19:17)</a>:</h4>
<p>hmm</p>



<a name="154194551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194551">(Jan 02 2019 at 19:17)</a>:</h4>
<p>we already invoke <code>tcx.collect_and_partition_mono_items</code></p>



<a name="154194555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194555">(Jan 02 2019 at 19:17)</a>:</h4>
<p>which is basically doing this for us</p>



<a name="154194560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194560">(Jan 02 2019 at 19:17)</a>:</h4>
<p>what we could do is to invoke that, which will give us a series of <code>MonoItem</code></p>



<a name="154194612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194612">(Jan 02 2019 at 19:18)</a>:</h4>
<p>we can then iterate over that list and make sure that each def-id within the list has a visitor</p>



<a name="154194624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194624">(Jan 02 2019 at 19:18)</a>:</h4>
<p>or at least each def-id meeting certain criteria, or something</p>



<a name="154194703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154194703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154194703">(Jan 02 2019 at 19:19)</a>:</h4>
<p>well I really mean each <code>InstanceDef::Item</code>, I suspect</p>



<a name="154195115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154195115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154195115">(Jan 02 2019 at 19:25)</a>:</h4>
<p>I could experiment with something like that.</p>



<a name="154195451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154195451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154195451">(Jan 02 2019 at 19:31)</a>:</h4>
<p>ok great, let me know how it goes</p>



<a name="154248573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154248573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154248573">(Jan 03 2019 at 16:09)</a>:</h4>
<p>Did you get a chance to look at this <span class="user-mention" data-user-id="116107">@davidtwco</span> ?</p>



<a name="154248590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154248590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154248590">(Jan 03 2019 at 16:09)</a>:</h4>
<p>Not yet, been responding to reviews so far today.</p>



<a name="154249155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154249155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154249155">(Jan 03 2019 at 16:19)</a>:</h4>
<p>OK</p>



<a name="154429109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154429109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154429109">(Jan 04 2019 at 19:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I might poke at this a bit more today if you haven't</p>



<a name="154429134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154429134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154429134">(Jan 04 2019 at 19:03)</a>:</h4>
<p>Feel free to, I'm just working on some changes for your review on another PR right now, was planning on tackling this next.</p>



<a name="154432214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154432214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154432214">(Jan 04 2019 at 19:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> to start i'm doing a rebase and will push -f</p>



<a name="154432224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154432224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154432224">(Jan 04 2019 at 19:51)</a>:</h4>
<p>Sounds good.</p>



<a name="154441526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154441526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154441526">(Jan 04 2019 at 22:12)</a>:</h4>
<p>Have you started on this <span class="user-mention" data-user-id="116009">@nikomatsakis</span>? Not got too long left in my day, but finished with other things and was going to take a look soon - just waiting on my build after pulling the rebase.</p>



<a name="154578323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154578323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154578323">(Jan 07 2019 at 15:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I did the rebase, but I didn't get any further</p>



<a name="154634211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154634211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154634211">(Jan 08 2019 at 09:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I've got something locally that continues to pass all our tests that also considers the <code>DefId</code>s from the <code>collect_and_partition_mono_items</code> (I had to continue to use the <code>body_owners</code> results too - as the mono items didn't include our local functions). I'm not sure if you have a test case that this should make pass or not. I've not done anything to make this lazy yet, not sure how I'd go about doing that.</p>



<a name="154636887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154636887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154636887">(Jan 08 2019 at 10:55)</a>:</h4>
<p>I am observing that the test functions (eg. <code>depend_size_alignment</code>) aren't being returned from <code>collect_and_partition_mono_items</code>  at the top of <code>polymorphize_analysis</code> where I'm calling it - or where it was being called in making the statistics.</p>



<a name="154636980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154636980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154636980">(Jan 08 2019 at 10:57)</a>:</h4>
<p>I'm guessing that this might be a result of these functions never being used with some concrete type at all - but I think that this would affect the space savings analysis?</p>



<a name="154637071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154637071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154637071">(Jan 08 2019 at 10:59)</a>:</h4>
<p>(Maybe this is helpful, I haven't read the code or the whole conversation) The collector, by default, is as lazy as possible. It will only collect functions that are transitively called from something that is publicly visible (e.g. <code>main</code> or functions exported from the current crate).</p>



<a name="154637162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154637162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154637162">(Jan 08 2019 at 11:00)</a>:</h4>
<blockquote>
<p>(Maybe this is helpful, I haven't read the code or the whole conversation) The collector, by default, is as lazy as possible. It will only collect functions that are transitively called from something that is publicly visible (e.g. <code>main</code> or functions exported from the current crate).</p>
</blockquote>
<p>I have tried making the functions public, and I'm now about to try calling them. I think what you are describing is exactly what I'm observing though, which I'm not sure we expected. Though, I might just be missing something.</p>



<a name="154637266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154637266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154637266">(Jan 08 2019 at 11:02)</a>:</h4>
<p>Though, in some of the test files, <span class="user-mention" data-user-id="116009">@nikomatsakis</span> has calls to our test functions, so perhaps they are aware of this.</p>



<a name="154638375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154638375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154638375">(Jan 08 2019 at 11:28)</a>:</h4>
<p>Alright, now I've got it working locally without needing the <code>body_owners</code> call too. Still not lazy but I think this is more in the spirit of what we wanted. I've pushed it to <a href="https://github.com/davidtwco/rust/tree/polymorphize-analysis" target="_blank" title="https://github.com/davidtwco/rust/tree/polymorphize-analysis">my fork</a> (just in case we're not happy with it) for now.</p>



<a name="154654450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154654450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154654450">(Jan 08 2019 at 16:07)</a>:</h4>
<blockquote>
<p>Though, in some of the test files, <span class="user-mention" data-user-id="116009">@nikomatsakis</span> has calls to our test functions, so perhaps they are aware of this.</p>
</blockquote>
<p>yes I was aware of this and I think it's fine, we just have to measure from an end-point</p>



<a name="154654463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154654463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154654463">(Jan 08 2019 at 16:07)</a>:</h4>
<p>I'll take a look <span class="user-mention" data-user-id="116107">@davidtwco</span>, thanks!</p>



<a name="154655148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655148">(Jan 08 2019 at 16:16)</a>:</h4>
<p>it looks right to me</p>



<a name="154655225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655225">(Jan 08 2019 at 16:17)</a>:</h4>
<p>the only thing I would say is: there is no need to invoke the fns we want to consider multiple times</p>



<a name="154655346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655346">(Jan 08 2019 at 16:19)</a>:</h4>
<p>I don't think I intended to add <code>-Zpolymorphize-dump</code> to each of the tests though..</p>



<a name="154655361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655361">(Jan 08 2019 at 16:19)</a>:</h4>
<p>...we could make dump the default, and add a flag to add all local methods for analysis</p>



<a name="154655368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655368">(Jan 08 2019 at 16:19)</a>:</h4>
<p>or we can just invoke them</p>



<a name="154655375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655375">(Jan 08 2019 at 16:19)</a>:</h4>
<p>the latter seems fine I guess</p>



<a name="154655804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655804">(Jan 08 2019 at 16:23)</a>:</h4>
<p>I didn’t think it was required to invoke each multiple times, I just wanted it to be consistent with the existing test that had invocations. </p>
<p>Unless we want to merge the body owners ids and mono item ids, we’ll need to invoke each function with this change.</p>



<a name="154655904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655904">(Jan 08 2019 at 16:24)</a>:</h4>
<p>right. apart from testing, I can't think of a reason to merge that</p>



<a name="154655918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655918">(Jan 08 2019 at 16:25)</a>:</h4>
<p>so I guess might as well leave it how you have it</p>



<a name="154655957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655957">(Jan 08 2019 at 16:25)</a>:</h4>
<p>it seems like we're close to the point where we can get some data now</p>



<a name="154655968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655968">(Jan 08 2019 at 16:25)</a>:</h4>
<p>it occurs to me it might be nice to have a mode that dumps out more detail about the duplicates</p>



<a name="154655969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154655969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154655969">(Jan 08 2019 at 16:25)</a>:</h4>
<p>as a sanity check</p>



<a name="154656070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656070">(Jan 08 2019 at 16:26)</a>:</h4>
<p>maybe repurpose the "dump" flag</p>



<a name="154656085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656085">(Jan 08 2019 at 16:27)</a>:</h4>
<p>er</p>



<a name="154656086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656086">(Jan 08 2019 at 16:27)</a>:</h4>
<p>wait</p>



<a name="154656096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656096">(Jan 08 2019 at 16:27)</a>:</h4>
<p>the dump flag is the one that shows the errors?</p>



<a name="154656106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656106">(Jan 08 2019 at 16:27)</a>:</h4>
<p>we should probably keep <em>that</em></p>



<a name="154656114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656114">(Jan 08 2019 at 16:27)</a>:</h4>
<p>maybe just emit the duplicates as <code>info!</code> level logging, then we can turn it on with <code>RUST_LOG</code></p>



<a name="154656137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656137">(Jan 08 2019 at 16:27)</a>:</h4>
<p>I'm guessing there are still dependencies we are not considering</p>



<a name="154656143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656143">(Jan 08 2019 at 16:27)</a>:</h4>
<p>not 100% sure what those are</p>



<a name="154656155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656155">(Jan 08 2019 at 16:28)</a>:</h4>
<p>I'll have to go over the list again</p>



<a name="154656209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656209">(Jan 08 2019 at 16:28)</a>:</h4>
<p>simple example: we consider fields, I think, but if you have <code>foo.bar[x]</code>, then the type of <code>foo.bar</code> had better have a known size</p>



<a name="154656229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656229">(Jan 08 2019 at 16:28)</a>:</h4>
<p>don't think we check for that</p>



<a name="154656627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656627">(Jan 08 2019 at 16:33)</a>:</h4>
<p>I'll look into adding that in a bit.</p>



<a name="154656634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154656634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154656634">(Jan 08 2019 at 16:33)</a>:</h4>
<p>Will push my latest change to your branch too.</p>



<a name="154665737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154665737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154665737">(Jan 08 2019 at 18:35)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I'm struggling to come up with an example where a <code>x[i]</code> (for some <code>x: T</code>) ends up as a <code>ProjectionElem::Index(..)</code> and not a call to <code>std::ops::Index::index</code>, any ideas?</p>



<a name="154668719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154668719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154668719">(Jan 08 2019 at 19:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> indexing into a <code>&amp;[T]</code> slice..maybe something like this?</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">dependency_because_index_depends_on_T_sized</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">parameters</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="n">T</span><span class="p">])</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nc">T</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">//~^ ERROR some polymorphic dependencies found</span>
<span class="w">    </span><span class="o">&amp;</span><span class="n">parameters</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="154668775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154668775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154668775">(Jan 08 2019 at 19:14)</a>:</h4>
<p>the name is slightly wrong</p>



<a name="154668792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154668792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154668792">(Jan 08 2019 at 19:14)</a>:</h4>
<p>even though we know that <code>T: Sized</code>, we still don't know how big it is -- or maybe you want <code>&amp;parameters[1]</code>, since..strictly speaking..<code>&amp;parameters[0]</code> <em>doesn't</em> depend</p>



<a name="154678839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154678839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154678839">(Jan 08 2019 at 21:31)</a>:</h4>
<p>Pushed a commit with that check, still considers <code>x[0]</code> a dependency for the moment.</p>



<a name="154729410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154729410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154729410">(Jan 09 2019 at 14:56)</a>:</h4>
<p>seems ok</p>



<a name="154729464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154729464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154729464">(Jan 09 2019 at 14:57)</a>:</h4>
<p>nice!</p>



<a name="154729479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154729479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154729479">(Jan 09 2019 at 14:57)</a>:</h4>
<p>I'll try to do another pass for missing things, but it seems like it'd be interesting to also start gathering some data now</p>



<a name="154729538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154729538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154729538">(Jan 09 2019 at 14:58)</a>:</h4>
<p>Running <code>-Z polymorphize</code> on actual crates?</p>



<a name="154729570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154729570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154729570">(Jan 09 2019 at 14:58)</a>:</h4>
<p>yeah, although it'll probably be so horrificially slow</p>



<a name="154729576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154729576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154729576">(Jan 09 2019 at 14:58)</a>:</h4>
<p>maybe we should look at opimizing the propagation a bit</p>



<a name="154729582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154729582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154729582">(Jan 09 2019 at 14:59)</a>:</h4>
<p>otoh who cares</p>



<a name="154729595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154729595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154729595">(Jan 09 2019 at 14:59)</a>:</h4>
<p>I guess it depends <em>how slow</em></p>



<a name="154729748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154729748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154729748">(Jan 09 2019 at 15:00)</a>:</h4>
<p>I guess the only downside to speeding it up now is that if we find that it isn't worth doing polymorphization then that would have been wasted effort?</p>



<a name="154734742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154734742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154734742">(Jan 09 2019 at 16:03)</a>:</h4>
<p>I guess</p>



<a name="154734749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154734749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154734749">(Jan 09 2019 at 16:03)</a>:</h4>
<p>I mean it seems worth trying it on a few smaller tests to start</p>



<a name="154734753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154734753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154734753">(Jan 09 2019 at 16:03)</a>:</h4>
<p>before we invest too much effort in optimizing</p>



<a name="154734758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154734758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154734758">(Jan 09 2019 at 16:03)</a>:</h4>
<p>not sure what a smaller test would be</p>



<a name="154734776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154734776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154734776">(Jan 09 2019 at 16:03)</a>:</h4>
<p>e.g. I'm curious to measure something like ripgrep</p>



<a name="154734787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154734787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154734787">(Jan 09 2019 at 16:03)</a>:</h4>
<p>I guess to do this properly we need to basically apply it to the transitive set of crates<br>
a</p>



<a name="154734792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154734792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154734792">(Jan 09 2019 at 16:03)</a>:</h4>
<p>and take the data from each one and collect</p>



<a name="154734846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154734846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154734846">(Jan 09 2019 at 16:04)</a>:</h4>
<p>that is, at each crate, we'll have various monomorphizations that we print out (and various things that were not locally used and hence which (may) be instantiated by clients)</p>



<a name="154735658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154735658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154735658">(Jan 09 2019 at 16:15)</a>:</h4>
<p>I guess we could look to <a href="https://perf.rust-lang.org/" target="_blank" title="https://perf.rust-lang.org/">https://perf.rust-lang.org/</a> to get some ideas for benchmarks.  Other thoughts:</p>
<ul>
<li>Command-line utilities:<ul>
<li><a href="https://crates.io/crates/tokei" target="_blank" title="https://crates.io/crates/tokei">https://crates.io/crates/tokei</a></li>
<li><a href="https://crates.io/crates/ripgrep" target="_blank" title="https://crates.io/crates/ripgrep">https://crates.io/crates/ripgrep</a></li>
<li><a href="https://crates.io/crates/cw" target="_blank" title="https://crates.io/crates/cw">https://crates.io/crates/cw</a></li>
</ul>
</li>
</ul>



<a name="154735757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154735757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154735757">(Jan 09 2019 at 16:16)</a>:</h4>
<p>maybe something crazy like <a href="https://github.com/gluon-lang/gluon" target="_blank" title="https://github.com/gluon-lang/gluon">https://github.com/gluon-lang/gluon</a></p>



<a name="154735769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154735769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154735769">(Jan 09 2019 at 16:16)</a>:</h4>
<p>or <a href="https://github.com/dagit/rust-prolog" target="_blank" title="https://github.com/dagit/rust-prolog">https://github.com/dagit/rust-prolog</a></p>



<a name="154764369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154764369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154764369">(Jan 09 2019 at 22:54)</a>:</h4>
<p>welp my attempt to run on <code>cw</code> immediately panicked :)</p>



<a name="154764377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154764377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154764377">(Jan 09 2019 at 22:54)</a>:</h4>
<p>something about invoking <code>Instance::resolve</code> failed</p>



<a name="154764417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154764417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154764417">(Jan 09 2019 at 22:55)</a>:</h4>
<p><span class="emoji emoji-1f641" title="frown">:frown:</span></p>



<a name="154764502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154764502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154764502">(Jan 09 2019 at 22:56)</a>:</h4>
<p>I think I know the problem tho</p>



<a name="154764608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154764608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154764608">(Jan 09 2019 at 22:57)</a>:</h4>
<p>in particular we need to normalize after substituting here:</p>
<div class="codehilite"><pre><span></span><span class="w">                    </span><span class="n">substituted_dependencies</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">visitor</span><span class="p">.</span><span class="n">dependencies</span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="n">dependency</span><span class="o">|</span><span class="w"> </span><span class="n">dependency</span><span class="p">.</span><span class="n">subst</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">call_edge</span><span class="p">.</span><span class="n">substs</span><span class="p">))</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">collect</span><span class="p">();</span><span class="w"></span>
</pre></div>



<a name="154764657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154764657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154764657">(Jan 09 2019 at 22:58)</a>:</h4>
<p>we could probably do the whole "trans thing" and erase regions too</p>



<a name="154764666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154764666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154764666">(Jan 09 2019 at 22:58)</a>:</h4>
<p>I wonder if there's a helper for this</p>



<a name="154765038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154765038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154765038">(Jan 09 2019 at 23:03)</a>:</h4>
<p>yes</p>



<a name="154766167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154766167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154766167">(Jan 09 2019 at 23:23)</a>:</h4>
<p>ye</p>



<a name="154766168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154766168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154766168">(Jan 09 2019 at 23:23)</a>:</h4>
<p>ye</p>



<a name="154766174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154766174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154766174">(Jan 09 2019 at 23:23)</a>:</h4>
<div class="codehilite"><pre><span></span>athena. RUST_BACKTRACE=1 cargo +rust-7-stage2 rustc -- -Zpolymorphize
   Compiling cw v0.3.0 (/home/nmatsakis/versioned/regr/cw)
note: Monomorphized items: 483

note: Monomorphized size : 10664

note: New total items    : 475 ( 98%)

note: New estimated size : 10579 ( 99%)
</pre></div>



<a name="154766177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154766177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154766177">(Jan 09 2019 at 23:23)</a>:</h4>
<p>not a complete measurement though</p>



<a name="154766187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154766187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154766187">(Jan 09 2019 at 23:24)</a>:</h4>
<p>That's not a particularly large decrease.</p>



<a name="154766235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154766235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154766235">(Jan 09 2019 at 23:24)</a>:</h4>
<p>nope</p>



<a name="154766240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154766240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154766240">(Jan 09 2019 at 23:24)</a>:</h4>
<p>not that I necessarily expected it would be for that particular test</p>



<a name="154766245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154766245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154766245">(Jan 09 2019 at 23:24)</a>:</h4>
<p>not sure if others will do better</p>



<a name="154766677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154766677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154766677">(Jan 09 2019 at 23:33)</a>:</h4>
<p>how was the performance running the analysis on a real crate?</p>



<a name="154841361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154841361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154841361">(Jan 10 2019 at 14:17)</a>:</h4>
<p>seemed fine</p>



<a name="154841481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154841481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154841481">(Jan 10 2019 at 14:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I was thinking of two things we should do:</p>
<ul>
<li>add some mode to dump out the duplicates we find, so we can sanity check</li>
<li>modify so that you can pass <code>-Zpolymorphization=level</code>, where the levels might mean different amounts of aggressiveness<br>
    - level 0 would be what we have now<br>
    - level 1 would be "resume we know the size/alignment of each type <code>T</code>"</li>
</ul>
<p>So for example, moving a value of type <code>T</code> is possible in level 1 but not level 0. Similarly indexing a slice of type <code>&amp;[T]</code> is possible in level 1 but not level 0. However, indexing into a struct like <code>(u32, T)</code> is not possible in either level (because we'd have to do complex calculations to figure out the offset.</p>



<a name="154841485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154841485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154841485">(Jan 10 2019 at 14:18)</a>:</h4>
<p>we might then add more levels in the future</p>



<a name="154841543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154841543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154841543">(Jan 10 2019 at 14:19)</a>:</h4>
<p>also, we should add some "sanity check" tests for cross-crate -- e.g., I'd like to test the following function:</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="nb">Vec</span><span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">];</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="p">.</span><span class="n">len</span><span class="p">();</span><span class="w"></span>

<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="nb">Vec</span><span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">];</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="p">.</span><span class="n">len</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>I <em>think</em> <code>x.len()</code> can get collapsed, but worth testing.</p>



<a name="154841623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154841623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154841623">(Jan 10 2019 at 14:20)</a>:</h4>
<p>Alright, I can probably find some time to do those later.</p>



<a name="154841900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154841900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154841900">(Jan 10 2019 at 14:24)</a>:</h4>
<p>Cool =)</p>



<a name="154872173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154872173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154872173">(Jan 10 2019 at 21:13)</a>:</h4>
<p>Pushed the above (except the cross-crate sanity check)</p>



<a name="154875110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154875110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154875110">(Jan 10 2019 at 21:53)</a>:</h4>
<p>cool</p>



<a name="154877532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877532">(Jan 10 2019 at 22:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> I think that this is a bit too permissive:</p>
<div class="codehilite"><pre><span></span><span class="w">                </span><span class="k">match</span><span class="w"> </span><span class="n">SizeSkeleton</span>::<span class="n">compute</span><span class="p">(</span><span class="n">ty</span><span class="p">,</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">param_env</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="nb">Ok</span><span class="p">(</span><span class="n">SizeSkeleton</span>::<span class="n">Known</span><span class="p">(</span><span class="n">_</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">debug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;record_dependency: known size, skipping&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">                        </span><span class="kc">false</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>
<span class="w">                    </span><span class="n">_</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">level</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="o">!</span><span class="n">kind</span><span class="p">.</span><span class="n">is_offset_of</span><span class="p">()</span><span class="w"> </span><span class="o">=&gt;</span><span class="w">  </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">debug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;record_dependency: unknown size, skipping as level above zero&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">                        </span><span class="kc">false</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>
<span class="w">                    </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">debug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;record_dependency: recording dependency&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">                        </span><span class="bp">self</span><span class="p">.</span><span class="n">push_dependency_if_new</span><span class="p">(</span><span class="n">span</span><span class="p">,</span><span class="w"> </span><span class="n">kind</span><span class="p">)</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
</pre></div>


<p>specifically, I think we want to check for cases where the type we need the size of is <em>exactly</em> a parameter</p>



<a name="154877535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877535">(Jan 10 2019 at 22:29)</a>:</h4>
<p>i.e., the type of <code>A</code></p>



<a name="154877545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877545">(Jan 10 2019 at 22:29)</a>:</h4>
<p>in contrast to something that <em>includes</em> <code>A</code>, like <code>(A, u32)</code></p>



<a name="154877549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877549">(Jan 10 2019 at 22:29)</a>:</h4>
<p>computing the size of the derived type is more complex</p>



<a name="154877554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877554">(Jan 10 2019 at 22:29)</a>:</h4>
<p>I can make an example perhaps</p>



<a name="154877641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877641">(Jan 10 2019 at 22:30)</a>:</h4>
<p>I understand what you mean, I’ll look at doing that.</p>



<a name="154877662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877662">(Jan 10 2019 at 22:30)</a>:</h4>
<p>actually the test you have is confusing me a bit</p>



<a name="154877678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877678">(Jan 10 2019 at 22:31)</a>:</h4>
<p>but also I maybe realized a complication</p>



<a name="154877679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877679">(Jan 10 2019 at 22:31)</a>:</h4>
<p>That should just be checking that <code>ty</code> is a <code>ty::TyKind::TyParam(..)</code>.</p>



<a name="154877690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877690">(Jan 10 2019 at 22:31)</a>:</h4>
<p>yes, right, I meant that <code>polymorphize-level1.rs</code> is confusing me a bit</p>



<a name="154877697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877697">(Jan 10 2019 at 22:31)</a>:</h4>
<p>in that I don't see a test that just moves a value of type <code>T</code></p>



<a name="154877698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877698">(Jan 10 2019 at 22:31)</a>:</h4>
<p>but I sort of expected to</p>



<a name="154877756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877756">(Jan 10 2019 at 22:32)</a>:</h4>
<p>but we also have one other wrinkle to be careful of, one sec..</p>



<a name="154877759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877759">(Jan 10 2019 at 22:32)</a>:</h4>
<p>Not knowing we only wanted a lone <code>T</code>, I just made a test for each kind of dependency.</p>



<a name="154877773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877773">(Jan 10 2019 at 22:32)</a>:</h4>
<p>Since it was the function that registered them and matched on the kind that changed.</p>



<a name="154877911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154877911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154877911">(Jan 10 2019 at 22:35)</a>:</h4>
<p>one complication I was thinking:</p>
<p>at least in level 1, when you invoke a function <code>foo::&lt;T1, T2&gt;</code> -- then each of the types <code>T1</code> and <code>T2</code> must have a known size</p>



<a name="154878016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154878016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154878016">(Jan 10 2019 at 22:36)</a>:</h4>
<p>as an example:</p>
<div class="codehilite"><pre><span></span><span class="c1">// just needs to know the size of `T`, ok in level 1</span>
<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">t</span>: <span class="nb">Box</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">T</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">*</span><span class="n">t</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">bar</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">a</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">// this call winds up requiring us to compute size of (T, u32)`</span>
<span class="w">    </span><span class="n">foo</span>::<span class="o">&lt;</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="p">)</span><span class="o">&gt;</span><span class="p">(</span><span class="nb">Box</span>::<span class="n">new</span><span class="p">((</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="mi">22</span><span class="p">)))</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="154878176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154878176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154878176">(Jan 10 2019 at 22:39)</a>:</h4>
<p>What is the purpose of the levels?</p>



<a name="154908120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154908120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154908120">(Jan 11 2019 at 10:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> the idea is this:</p>
<ul>
<li>Level 0 is what we could do today just by "not generating more than one fn"</li>
<li>Level 1 is what we could do if we modified code generator to pass the sign/alignment (two integers) for each type parameter when invoking a "polymorphized" function</li>
<li>Level 2 (if we were to add it) might be what we could do if we modified the code generator in other ways, for example by generating the code to full layout at runtime (which would enable "offset-of" dependencies)</li>
<li>Level infinity would I guess be what we could do if we modified the runtime to have enough power to do trait resolution =)</li>
</ul>



<a name="154908133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154908133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154908133">(Jan 11 2019 at 10:33)</a>:</h4>
<p>(this way we could try to get an idea if the runtime work is worthwhile)</p>



<a name="154908183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/154908183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#154908183">(Jan 11 2019 at 10:34)</a>:</h4>
<p>I see.</p>



<a name="155073710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/155073710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#155073710">(Jan 14 2019 at 10:03)</a>:</h4>
<p>Pushed a change that should make that check less permissive.</p>



<a name="155255967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/155255967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#155255967">(Jan 16 2019 at 14:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> cool, let me check tha tout</p>



<a name="156967365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/156967365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#156967365">(Jan 27 2019 at 10:48)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> what’s next here?</p>



<a name="157055912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/157055912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#157055912">(Jan 28 2019 at 20:44)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> sigh, I've been wondering the same thing.</p>



<a name="157055917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/157055917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#157055917">(Jan 28 2019 at 20:44)</a>:</h4>
<p>I guess we need to try it out on more crates</p>



<a name="157275021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/157275021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#157275021">(Jan 31 2019 at 14:27)</a>:</h4>
<p>Ugh. =) <span class="user-mention" data-user-id="116107">@davidtwco</span> sorry been paralyzed here =)</p>



<a name="157275056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/polymorphization%20estimates/near/157275056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/polymorphization.20estimates.html#157275056">(Jan 31 2019 at 14:27)</a>:</h4>
<p>That's all good. I'm sure the All Hands planning is keeping you busy.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>